package com.koudai.finance.controller;

import com.koudai.finance.service.PayService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * @Description: 支付Controller
 * @Author: ls
 * @Date: 2020/08/10 12:02
 */
@Api(tags = "支付模块")
@RestController
@RequestMapping("/pay")
public class PayController {

    @Resource
    private PayService payServiceImpl;

    @ApiOperation(value = "创建支付二维码")
    @PostMapping("/createNative")
    public Map<String, Object> createNative(HttpServletRequest request, String totalFee) throws Exception {
        return payServiceImpl.createNative(request, totalFee);
    }

    @ApiOperation(value = "微信支付回调通知")
    @PostMapping("/wxPayCallBack")
    public void wxPayCallBack(HttpServletRequest request, HttpServletResponse response) throws Exception {
        payServiceImpl.wxPayCallBack(request, response);
    }

}